/*
 * Created on 2006-10-30
 *
 */
package edu.pku.sei.modeler.figures;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;

/**
 * @author zhangle
 *
 */
public class TemplateInterfaceFigure extends Figure {
	private Point conn_start;
	private Point conn_end;
	protected void paintFigure(Graphics graphics) {
		double angle = 0;
		if(conn_start != null && conn_end != null) {
			int x = conn_end.x - conn_start.x;
			int y = conn_start.y - conn_end.y;
			double radian = java.lang.Math.atan2(y, x);
			angle = (radian/java.lang.Math.PI)*180;
		}
		graphics.setLineWidth(2);
		Rectangle bound = this.getBounds();
		graphics.drawArc(bound.x, bound.y, bound.width-1, bound.height-1, 90+(int)angle, 180);
	}
	/**
	 * @return Returns the conn_end.
	 */
	public Point getConn_end() {
		return conn_end;
	}
	/**
	 * @param conn_end The conn_end to set.
	 */
	public void setConn_end(Point conn_end) {
		this.conn_end = conn_end;
	}
	/**
	 * @return Returns the conn_start.
	 */
	public Point getConn_start() {
		return conn_start;
	}
	/**
	 * @param conn_start The conn_start to set.
	 */
	public void setConn_start(Point conn_start) {
		this.conn_start = conn_start;
	}
}
